/**
 * 
 * 动态改变列表的宽度和高度
 * @param {number} colnum 列表列数
 * @param {number} num 设置高度的缓冲值
 */
function calScreenWidth (colnum, num) {
    num = num || 100
    // 计算每列平均宽度
    let screenWidth = document.body.clientWidth // 屏幕宽
    let averWidth = Math.floor(screenWidth / colnum)
    // 初始化表单高度
    const that = this
    let heightStyle = that.$refs.tableCot.offsetHeight - num
    that.Height = heightStyle
    that.averWidth = averWidth
    // 监听窗口变化
    window.onresize = () => {
        return (() => {
            let screenWidth = document.body.clientWidth // 屏幕宽
            that.averWidth = Math.floor(screenWidth / colnum)
            let heightStyle = that.$refs.tableCot.offsetHeight - num
            that.Height = heightStyle
        })()
    }
}

export default calScreenWidth